Skip to main content

Setting up Agents to query your Ms. SQL Database

This guide will walk you through configuring Agents to query your Ms. SQL Database. Before following this guide, ensure that you have set up your Ms. SQL tools already by following the instructions [here](Ms. SQL Tools setup.md).

To configure these agents, you will require the following components added to your project

  1. Ms. SQL SQL Query Tool
  2. Ms. SQL Metadata Retrieval Tool
  3. Memory object
  4. LLM model

Metadata Retrieval Agent

The Metadata Retrieval Agent will be a scheduled Agent to retrieve the Metadata associated with the Ms. SQL Database, and populate a Memory object.

SQL Query Agent

The SQL Query Agent will use the Metadata retrieved from the Memory object to allow the user to query their Database.

Agent Setups

Metadata Retrieval Agent

The Agent setup should have a LLM, Memory block, and Metadata Retrieval tool.

Ms. SQL SQL Metadata agent

  1. Add the LLM to the Agent
  2. Add the Metadata Retrieval tool to the LLM
  3. Add the Memory block to the Agent

The following connections are needed:

  1. Input line to LLM
  2. LLM line to Output
  3. Memory line to Output

Schedule the Agent by

  1. Selecting the gear icon on the Input block
  2. Turning on Schedule Execution
  3. Providing a time range to repeat metadata retrieval. This would be based on how often you expect your data to change.

Add Ms. SQL Query tool

Metadata Retrieval Agent

The Agent setup should have a LLM, Memory block (same as previous), and SQL Query tool. MySQL Query agent

  1. Add the LLM to the Agent
  2. Add the SQL Query tool to the LLM
  3. Add the Memory block to the Agent

The following connections are needed:

  1. Input line to LLM
  2. LLM line to Output
  3. Memory line to LLM

[!NOTE] Your Ms. SQL server must be accessible by Public IP. If you're having trouble connecting to your Ms. SQL server, you can reach out to us at [email protected] and we can provide you any IPs you may need to whitelist on your firewall to allow the tools to connect.